/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.netcracker.test.nine;

import java.util.Comparator;

/**
 *
 * @author I
 */
public class Person {
    private String name;
    private String surname;
    private String patronimyc;
    public Person(String n, String s, String p)
    {
        name =n;
        surname = s;
        patronimyc = p;
    }
    public void setName(String n)
    {
        name=n;
    
    }
    public String getName()
    {
        return name;
    }
    public void setSurname(String s)
    {
        surname=s;
    
    }
    public String getSurname()
    {
        return surname;
    }
    public void setPatronimyc(String p)
    {
        patronimyc=p;
    
    }
    public String getPatronymic()
    {
        return patronimyc;
    }
    public static class SortPerson implements Comparator<Person>
    {
        @Override
        public int compare(Person p1, Person p2) 
        {
            int result;
            result = (int) p1.name.compareTo(p2.name);
            if(result==0)
            {
                result = (int) p1.surname.compareTo(p2.surname);
                if(result==0)
                {
                    result = (int) p1.patronimyc.compareTo(p2.patronimyc);
                    return result;
                }
                else
                    return result;
            }
            else 
                return result;      
        }

    }
}
